package edu.zut.cs.software.example.Menu.domain;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;

import edu.zut.cs.software.example.domain.BaseEntity;

/**
 * @author chen ming yang
 * 
 */

@Entity
@Table(name = "submenu")
public class SubMenu  extends BaseEntity<Long> {

	private static final long serialVersionUID = 3777462340029824642L;

	// child's parent
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, optional = false)
	@JoinColumn(name = "mid")
	@JSONField(serialize = false)
	private MainMenu mainMenu;
	@Column
	private String path;
	@Column
	private String title;
	
	

	public SubMenu() {
		super();
	}

	public SubMenu(MainMenu mainMenu, String path, String title) {
		super();
		this.mainMenu = mainMenu;
		this.path = path;
		this.title = title;
	}

	public Long getId() {
		return id;
	}

	public MainMenu getMainMenu() {
		return mainMenu;
	}

	public String getPath() {
		return path;
	}

	public String getTitle() {
		return title;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setMainMenu(MainMenu mainMenu) {
		this.mainMenu = mainMenu;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Override
	public String toString() {
		return "Submenu [id=" + id + ", title=" + title + ", path=" + path + "]";
	}

}
